
DEPENDS:append:sdkmingw32 = " nativesdk-prebuild-python"
RDEPENDS:${PN}:append:sdkmingw32 = " nativesdk-prebuild-python"
EXTRA_OECONF:remove:sdkmingw32 = "--without-python --with-python=no"
EXTRA_OECONF:append:sdkmingw32 = " --with-python=${WORKDIR}/python_win"
CXXFLAGS:append:sdkmingw32 = " -D_hypot=hypot"

do_configure:prepend:sdkmingw32() {
cat > ${WORKDIR}/python_win << EOF
#! /bin/sh
case "\$2" in
        --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}" ;;
        --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -lpython312" ;;
        --exec-prefix) echo "${exec_prefix}" ;;
        *) exit 1 ;;
esac
exit 0
EOF
        chmod +x ${WORKDIR}/python_win
}

GDB_DEPENDENCIES = "\
    libexpat-1.dll \
    libiconv-2.dll \
    libintl-8.dll \
    liblzma-5.dll \
    libstdc++-6.dll \
    python312.dll \
    python312.zip \
"

do_install:append:sdkmingw32() {
    # symlink gdb dependencies
    for dep in ${GDB_DEPENDENCIES}; do
        ln -s ../$dep ${D}${bindir}/
    done
}
